export const optChoice = {
  1: 'A',
  2: 'B',
  3: 'C',
  4: 'D',
}

export const optJudge = {
  1: '对',
  2: '错',
}

export const Single_Choice_Qu = 1
export const Judgement_Qu = 2
export const Multipe_Choice_Qu = 3
export const Blank_Qu = 4
export const Answer_Qu = 5

export function getQuAnswer(type, answer) {
  switch (type) {
    case Single_Choice_Qu:
      return optChoice[answer]
    case Judgement_Qu:
      return optJudge[answer]
    case Multipe_Choice_Qu:
      return answer.split('$').map(x => optChoice[x]) + ''
    case Blank_Qu:
      return answer.split('$') + ''
    case Answer_Qu:
      return answer
    default:
      return ''
  }
}

export function getUAnswer(type, answer, answers) {
  switch (type) {
    case Single_Choice_Qu:
      return optChoice[answer]
    case Judgement_Qu:
      return optJudge[answer]
    case Multipe_Choice_Qu:
      return answers.map(x => optChoice[x]) + ''
    case Blank_Qu:
    case Answer_Qu:
      return answer
    default:
      return ''
  }
}
